//package com.dlwx.parttimetalent.ui;
//
//import android.content.Intent;
//import android.net.Uri;
//import android.os.Bundle;
//import android.support.design.widget.TabLayout;
//import android.support.v4.app.Fragment;
//import android.support.v4.app.FragmentManager;
//import android.support.v4.app.FragmentTransaction;
//import android.support.v7.widget.GridLayoutManager;
//import android.view.View;
//import android.view.WindowManager;
//import android.widget.FrameLayout;
//import android.widget.ImageView;
//import android.widget.TextView;
//
//import com.dlwx.parttimetalent.R;
//import com.dlwx.parttimetalent.adapter.LabelRedAdapter;
//import com.dlwx.parttimetalent.base.BaseActivity;
//import com.dlwx.parttimetalent.bean.LabelBean;
//import com.dlwx.parttimetalent.fragment.label.LabelCustomFragment;
//import com.dlwx.parttimetalent.fragment.label.LabelFiveFragment;
//import com.dlwx.parttimetalent.fragment.label.LabelZeroFragment;
//import com.github.jdsjlzx.ItemDecoration.GridItemDecoration;
//import com.github.jdsjlzx.recyclerview.LRecyclerView;
//import com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter;
//
//import java.util.ArrayList;
//import java.util.List;
//
//import butterknife.BindView;
//import butterknife.ButterKnife;
//import butterknife.OnClick;
//
//public class SetLabelActivity extends BaseActivity implements LabelZeroFragment.OnFragmentInteractionListener {
//
//    @BindView(R.id.title_left_one_btn)
//    ImageView titleLeftOneBtn;
//    @BindView(R.id.tv_middle_title)
//    TextView tvMiddleTitle;
//    @BindView(R.id.framelayout)
//    FrameLayout framelayout;
//    @BindView(R.id.tv_confirm)
//    TextView tvConfirm;
//    @BindView(R.id.tablayout)
//    TabLayout tablayout;
//    @BindView(R.id.recyclerView)
//    LRecyclerView recyclerView;
//
//    private FragmentManager fragmentManager;
//    private List<Fragment> fragments = new ArrayList<>();
//    private Fragment lastFragment;
//    private Fragment fragment;
//    private LabelRedAdapter mAdapter;
//    private ArrayList<LabelBean> mDatas;
//
//    @Override
//    protected void onCreate(Bundle savedInstanceState) {
//        super.onCreate(savedInstanceState);
//        getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
//        setContentView(R.layout.activity_set_label);
//        ButterKnife.bind(this);
//        fragmentManager = this.getSupportFragmentManager();
//        initView();
//    }
//
//    private void initView() {
//        tvMiddleTitle.setVisibility(View.VISIBLE);
//        tvMiddleTitle.setText("我的标签");
//        titleLeftOneBtn.setVisibility(View.VISIBLE);
//        fragments.add(new LabelZeroFragment());
//        fragments.add(new LabelZeroFragment());
//        fragments.add(new LabelZeroFragment());
//        fragments.add(new LabelZeroFragment());
//        fragments.add(new LabelZeroFragment());
//        fragments.add(new LabelFiveFragment());
//        fragments.add(new LabelZeroFragment());
//        fragments.add(new LabelZeroFragment());
//        fragments.add(new LabelZeroFragment());
//        fragments.add(new LabelCustomFragment());
//        changeFragment(0);
//        tablayout.addTab(tablayout.newTab().setText("休闲娱乐"));
//        tablayout.addTab(tablayout.newTab().setText("运动健身"));
//        tablayout.addTab(tablayout.newTab().setText("私家定制"));
//        tablayout.addTab(tablayout.newTab().setText("自由工作"));
//        tablayout.addTab(tablayout.newTab().setText("出行必备"));
//        tablayout.addTab(tablayout.newTab().setText("行业用人"));
//        tablayout.addTab(tablayout.newTab().setText("高颜值男神/女神"));
//        tablayout.addTab(tablayout.newTab().setText("行业大佬"));
//        tablayout.addTab(tablayout.newTab().setText("名人堂"));
//        tablayout.addTab(tablayout.newTab().setText("自定义"));
//        tablayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
//            @Override
//            public void onTabSelected(TabLayout.Tab tab) {
//                int position = tab.getPosition();
//                changeFragment(position);
//            }
//
//            @Override
//            public void onTabUnselected(TabLayout.Tab tab) {
//            }
//
//            @Override
//            public void onTabReselected(TabLayout.Tab tab) {
//            }
//        });
//
//        recyclerView.setLayoutManager(new GridLayoutManager(this,5));
//        mAdapter=new LabelRedAdapter(this);
//        mDatas=new ArrayList<LabelBean>();
//        for(int i=0;i<10;i++){
//            LabelBean bean=new LabelBean();
//            bean.setId(i);
//            bean.setLabelName("标签"+i);
//            mDatas.add(bean);
//        }
//        mAdapter.setDataList(mDatas);
//        LRecyclerViewAdapter lRecyclerViewAdapter=new LRecyclerViewAdapter(mAdapter);
//        //divider
//        GridItemDecoration divider = new GridItemDecoration.Builder(this)
//                .setHorizontal(R.dimen.size_4)
////                 .setVertical(R.dimen.size_4)
//                .setColorResource(R.color.white)
//                .build();
//        recyclerView.setHasFixedSize(true);
//        recyclerView.addItemDecoration(divider);
//        recyclerView.setAdapter(lRecyclerViewAdapter);
//        recyclerView.setLoadMoreEnabled(false);
//        recyclerView.setPullRefreshEnabled(false);
//
//    }
//
//    private void changeFragment(int i) {
//        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
//        // 上一个不为空 隐藏上一个
//        if (lastFragment != null) {
//            transaction.hide(lastFragment);
//        }
//        fragment = fragments.get(i);
//        // fragment不能重复添加 // 添加过 显示 没有添加过 就隐藏
//        if (fragment.isAdded()) {
//            transaction.show(fragment);
//        } else {
//            transaction.add(R.id.framelayout, fragment);
//        }
//        transaction.commit();
//        lastFragment = fragment;
//    }
//
//    @OnClick({R.id.title_left_one_btn, R.id.tv_confirm})
//    public void onViewClicked(View view) {
//        switch (view.getId()) {
//            case R.id.title_left_one_btn:
//                this.finish();
//                break;
//            case R.id.tv_confirm:
//                startActivity(new Intent(this,ContactsActivity.class));
//                break;
//        }
//    }
//
//    @Override
//    public void onFragmentInteraction(Uri uri) {
////        ToastUtils.toastForShort(this,"haha");
//    }
//}
